ANDROID: cpu/hotplug: call perf event through function pointer

After commit ca927bd22ad8 ("ANDROID: cpu/hotplug: avoid breaking Android
ABI by fusing cpuhp steps") a build error appears with
CONFIG_PERF_EVENTS disabled:

In file included from ./include/uapi/linux/posix_types.h:5,
                 from ./include/uapi/linux/types.h:14,
                 from ./include/linux/types.h:6,
                 from ./include/linux/limits.h:6,
                 from ./include/linux/kernel.h:7,
                 from ./include/linux/sched/mm.h:5,
                 from kernel/cpu.c:6:
kernel/cpu.c: In function 'random_and_perf_prepare_fusion':
./include/linux/stddef.h:8:14: error: called object is not a function or function pointer
 #define NULL ((void *)0)
              ^
./include/linux/perf_event.h:1607:29: note: in expansion of macro 'NULL'
 #define perf_event_init_cpu NULL
                             ^~~~
kernel/cpu.c:1686:2: note: in expansion of macro 'perf_event_init_cpu'
  perf_event_init_cpu(cpu);
  ^~~~~~~~~~~~~~~~~~~
  CC      kernel/power/console.o
make[1]: *** [scripts/Makefile.build:287: kernel/cpu.o] Error 1
make[1]: *** Waiting for unfinished jobs....

Fix this by always calling through the function pointers like the
original code.

Fixes: ca927bd22ad8 ("ANDROID: cpu/hotplug: avoid breaking Android ABI by fusing cpuhp steps")
Reported-by: Anand Gore <anand.gore@broadcom.com>
Reported-by: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Todd Kjos <tkjos@google.com>
Change-Id: I46a7c4a056d96eb531c06d8d0bbfdc7eac1cb271
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
diff --git a/kernel/cpu.c b/kernel/cpu.c
index eed8ad1..fbcc2d6 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1683,14 +1683,24 @@
 /* Horrific hacks because we can't add more to cpuhp_hp_states. */
 static int random_and_perf_prepare_fusion(unsigned int cpu)
 {
-	perf_event_init_cpu(cpu);
-	random_prepare_cpu(cpu);
+	int (*fn)(unsigned int cpu);
+	fn = perf_event_init_cpu;
+	if (fn)
+		fn(cpu);
+	fn = random_prepare_cpu;
+	if (fn)
+		fn(cpu);
 	return 0;
 }
 static int random_and_workqueue_online_fusion(unsigned int cpu)
 {
-	workqueue_online_cpu(cpu);
-	random_online_cpu(cpu);
+	int (*fn)(unsigned int cpu);
+	fn = workqueue_online_cpu;
+	if (fn)
+		fn(cpu);
+	fn = random_online_cpu;
+	if (fn)
+		fn(cpu);
 	return 0;
 }